/***************************************************************************
 创建者: 华磊
 开始时间: 2020.8.14
 copyright: (C) 华友高科
 修改说明: (每次有修改就添加一条，带有 修改人，修改时间，修改描述)
 example (1) hualei 2020.5.8 类的具体实现代码编写

 ***************************************************************************
 *  @file x.h
 *  功能:
 *
 *                                                                         *
 ***************************************************************************/
#ifndef TESTFORM_H
#define TESTFORM_H

#include <QWidget>
#include <QTimer>

#include <QCheckBox>
#include <QLabel>
#include <QLineEdit>
#include "gSoapFoundation/soapStub.h"

//using namespace hmigsoapnamespace;


class IoController;
namespace Ui {
class testForm;
}
/**
 * @brief The testForm class 测试IO用
 */
class  testForm : public QWidget
{
    Q_OBJECT

public:
    explicit testForm(QWidget *parent = 0);
    ~testForm();
public:
    int readVersion(std::vector <ComponentVersion> &componentVersionList);

public slots:
    void timeoutDo();
    void setDoValue(bool checked);
    void setVirtualDiState(bool checked);

private slots:

    void on_checkBox_servo_on_toggled(bool checked);

    void on_pushButton_clearError_clicked();

    void on_checkBox_dir_toggled(bool checked);

    void on_pushButton_run_pressed();

    void on_pushButton_run_released();

    void on_checkBox_run_toggled(bool checked);

    void on_spinBox_num_valueChanged(int arg1);

    void on_checkBox_allaxis_toggled(bool checked);

    void on_horizontalSlider_sliderMoved(int position);

    void on_pushButton_stop_clicked();

    void on_comboBox_axis_currentIndexChanged(int index);

    void on_spinBox_dir_ms_valueChanged(int arg1);

    void on_checkBox_updateTimer_clicked(bool checked);

    void on_pushButton_setControlWord_clicked();

private:
    void displayStatusWord(unsigned short wordIn, unsigned short contrlWordIn);

private:
    Ui::testForm *ui;
    QCheckBox* controlWord_box[16];
    QCheckBox* statusWord_box[16];
    QCheckBox* virtual_di_box[64];
    QCheckBox* di_box[64];
    QCheckBox* do_box[64];
    QLineEdit* ai_box[64];
    QLineEdit* ao_box[64];

    QLabel* axis_box[16];

    QTimer* timer;

    int  getpos;
    bool manual_dir;
    bool manual_input;
    ComponentVersion versionInfo;
};

#endif // TESTFORM_H
